home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 187 < prev    next >
Encoding:
Text File  |  1996-08-05  |  4.4 KB  |  163 lines

  1. Path: zeke.ebtech.net!news
  2. From: panderso@ebtech.net (Paul Anderson)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: EMM386 Problem - main.c (0/1)
  5. Date: Wed, 03 Jan 1996 20:12:36 GMT
  6. Organization: Electro-Byte Technologies 
  7. Message-ID: <4cd3mb$cfo@zeke.ebtech.net>
  8. References: <4c9o94$640@zeke.ebtech.net> <4cc776$dah@gatekeeper.cng.com>
  9. NNTP-Posting-Host: line31.ebtech.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. "Ian G. Crozier" <ian_g_crozier@cngp.cng.com> wrote:
  13.  
  14. >panderso@ebtech.net (Paul Anderson) wrote:
  15. >>I'm writing a menu program, I don't have much of it done yet, but on
  16. >>running the exec of what I have done I get EMM386 Exception error #12
  17. >>or #06.  I use Watcom's compiler.  I've attached the source.
  18. >>
  19.  
  20. >I'm not surprised that you're having problems with your program.
  21.  
  22. >You've posted NINE messages, none of which give any useful information
  23. >about your code!!
  24.  
  25. Uh-ohhhh.......  Sorry, mail reader hickup...  Some of them where
  26. supposed to have the source attached, but, I can't change the
  27. encoding!!!  I can just import the source, and here goes:
  28.  
  29. /*
  30.         A menu prog, I am bored, so, why not put in *MY* bid to take
  31.         the place of MM?  Oooohhhh....  Let's see,
  32.         We want lots of configurability.  Igor!  Bring the config
  33. files!
  34. */
  35.  
  36. #include <stdio.h>
  37. #include <stdlib.h>
  38. #include "menu.h"
  39.  
  40. main(int argc, char *argv[])
  41. {
  42.         int i=1;
  43.         /* Engage command-line parser! */
  44.  
  45.         if (argc == 1) {
  46.                 printf("\a\nUuuuhhhhh... Yer supposed to tell me the
  47. config file name.");
  48.                 exit(0);
  49.                 }
  50.         /* Okey-dokey, got that down, let's plop up the for loop.*/
  51.         while(0==0)  /* Index=2(i.e. second param, first is: menu.exe)
  52. Up Mr. Index. */
  53.         {
  54.                /* printf("%s", argv[i]);*/
  55.                /* Bug test... */
  56.                /*i=i + 1;*/
  57.                /* We only need the config file name, nothing else. */
  58.                /* Remember, include config file var def in h file. */
  59.                config=fopen(argv[i], "r" );
  60.                if (config == NULL)
  61.                         {
  62.                         /* Uh-oh...  *BIG* problem... */
  63.                         printf("\a\nError: Unable to open config file
  64. %s!", argv[i]);
  65.                         printf("\nRead docs for help.");
  66.                         exit(1);
  67.                         }
  68.                /* Now, let us test the error. */
  69.  
  70.                i=loadcnf(config);
  71.                exit(0); /* Exit prog...*/
  72.  
  73.         }
  74.          /*Let's roast this sucker....*/
  75. }
  76.  
  77. atexit()
  78. {
  79.         fclose(config);
  80.         return 0;
  81. }
  82.  
  83. /* Config file data loader. */
  84.  
  85. int loadcnf(FILE *in)
  86. {
  87.         char indata[40];
  88.         int tmp;
  89.         /* Struct defed in menu.h... */
  90.         fscanf(in,"%s", &indata);
  91.         if (indata=="ON")
  92.                 {
  93.                 tmp=1;
  94.                 }
  95.                 else
  96.                 {
  97.                 tmp=0;
  98.                 }
  99.         /*Parms.Color = tmp;*/
  100.         /*indata="";*/
  101.         fscanf(in, "%s", &indata);
  102.         Parms.EntryOne = indata; /* The beginnings of a long and
  103. painful process...*/
  104.         /*indata="";*/
  105.         fscanf(in, "%s", &indata);
  106.         Parms.EntryOnePath = indata;
  107.         fscanf(in, "%s", &indata);
  108.         Parms.EntryTwo = indata;
  109.         fscanf(in, "%s", &indata);
  110.         Parms.EntryTwoPath = indata;
  111.         fscanf(in, "%s", &indata);
  112.         Parms.EntryThree = indata;
  113.         fscanf(in, "%s", &indata);
  114.         Parms.EntryThreePath = indata;
  115.         fscanf(in, "%s", &indata);
  116.         Parms.EntryFour = indata;
  117.         fscanf(in, "%s", &indata);
  118.         Parms.EntryFourPath = indata;
  119.         fscanf(in, "%s", &indata);
  120.         Parms.EntryFive = indata;
  121.         fscanf(in, "%s", &indata);
  122.         Parms.EntryFivePath = indata;
  123.         fscanf(in, "%s", &indata);
  124.         Parms.EntrySix = indata;
  125.         fscanf(in, "%s", &indata);
  126.         Parms.EntrySixPath = indata;
  127.         /* YESSSSSSS!!!!!  I am *DONE* setting up the config
  128. reader!!!*/
  129.         return 0;
  130. }
  131.  And the header file:
  132.  
  133. /* Filling garbage...*/
  134. FILE *config;
  135. struct
  136. {
  137.         int *Color;
  138.         char *EntryOne;
  139.         char *EntryOnePath;
  140.         char *EntryTwo;
  141.         char *EntryTwoPath;
  142.         char *EntryThree;
  143.         char *EntryThreePath;
  144.         char *EntryFour;
  145.         char *EntryFourPath;
  146.         char *EntryFive;
  147.         char *EntryFivePath;
  148.         char *EntrySix;
  149.         char *EntrySixPath;
  150.         char *RegName;
  151. } Parms;
  152.  
  153. int loadcnf(FILE *in);
  154.  
  155. /*Parms data;*/
  156.  
  157. Sorry for the mistake!!!  TTYL!
  158.  
  159.  
  160.  
  161.  
  162.  
  163.